Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing /
Chapter 3 - Page Formatting and Dialog Box Customization / Using Printing-Related Collection Objects


Accessing Data From a Collection Object

The following example shows you how to access an item from a collection object. For an example of adding an item to a collection object, see "Associating Format Objects With Document Pages" on page 3-61. For an example of replacing a collection item, see "Using a Collection to Implement the Print One Copy Menu Item" on page 3-29.

Listing 3-3 shows how to use the GXGetJobCollection function to access the number of copies, which is stored in a job collection.

Listing 3-3 Accessing copies information stored in a job collection

OSErr MyGetJobCopies(MyDocumentPtr myDocument, long *numCopies)
{
   OSErr          err;
   Collection     jobCollection;
   gxCopiesInfo   theCopiesInfo;
   long           dataSize = sizeof(theCopiesInfo);

   /* 
      Get the job collection and look for a gxCopiesTag collection 
      object item.
   */
   jobCollection = GXGetJobCollection(myDocument->documentJob);
   err = GetCollectionItem(jobCollection,
                           gxCopiesTag,
                           gxPrintingTagID,
                           dataSize,
                           &theCopiesInfo);
   /* Extract the number of copies and return it. */
   if (err == noErr)
      *numCopies = theCopiesInfo.copies;
   return err;
}

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help